package com.shr.lease.common.context;

/**
 * @author Haoran Sun
 * @since 2024/06/22
 */


public class LoginUserContext {

    private static final ThreadLocal<LoginUser> userThreadLocal = new ThreadLocal<>();

    public static void setLoginUser(LoginUser user){
        userThreadLocal.set(user);
    }

    public static LoginUser getLoginUser(){
        return userThreadLocal.get();
    }

    /**
     * 销毁方法
     */
    public static void removeLoginUser(){
        userThreadLocal.remove();
    }
}
